//
//  VMCCategoryApi.m
//  vmcshop
//
//  Created by bigknife on 14/11/1.
//  Copyright (c) 2014年 idongler. All rights reserved.
//

#import "VMCCategoryApi.h"

@implementation VMCCategoryApi

//单例对象创建的标准方法
//+ (instancetype) sharedInstance{
//	static VMCCategoryApi *instance;
//	static dispatch_once_t once;
//	dispatch_once(&once,^{
//		instance = [[self alloc] init];
//	});
//	return instance;
//}

+(instancetype) sharedInstance {
    static VMCCategoryApi *instance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[self alloc]init];
    });
    return instance;
}
/*!
 @class
 @abstract      商品分类
 @discussion
 */
-(void) loadCategoriesOfCategory:(API_CALLBACK)callback {
	ApiRequest *request = [ApiRequest requestWithBizData:@{}];
	[self postApi:@"emc_goods/getAllOneTwoThreeCatInfos"
	   andRequest:request
		 callback:callback];
}

-(void) loadCategoriesOfSuperCategory:(NSString *)superCategoryId
                          pageEnabled:(BOOL)pageEnabled
                            pageIndex:(NSInteger)pageIndex
                             pageSize:(NSInteger)pageSize
                             callback:(API_CALLBACK)callback {
    NSString *tmpSuperCategoryId = superCategoryId;
    if(!tmpSuperCategoryId){
        tmpSuperCategoryId = @"0";
    }
    ApiRequest *request = [ApiRequest requestWithBizData:@{
                                                           @"superCategory" : EMPTY_IF_NIL(tmpSuperCategoryId)/*,
                                                           @"pageEnabled" : pageEnabled ? ApiTrue : ApiFalse,
                                                           @"pageIndex" : [NSString stringWithFormat:@"%d",(int)pageIndex],
                                                           @"pageSize" : [NSString stringWithFormat:@"%d",(int)pageSize]*/
                                                           }];
    [self postApi:@"emc_goods/catalog"
          andRequest:request
            callback:callback];
}
@end
